import java.util.HashMap;

class ClassTable extends HashMap<String, Class>
{
   public void add(Class c) throws BabytalkRuntimeException
   {
      if (containsKey(c.getName()))
         throw new BabytalkRuntimeException("class '" + c.getName() + "' already added");
      
      put(c.getName(), c);
   }

   public Class get(String name) throws BabytalkRuntimeException
   {
      if (!containsKey(name))
         throw new BabytalkRuntimeException("no " + name + " class in table");
      return super.get(name);
   }
}
